home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / c / jpl_c.zip / RINDEX.C < prev    next >
Text File  |  1986-05-18  |  768b  |  27 lines

  1. /* 1.0  07-06-84 */
  2. /************************************************************************
  3.  *            Robert C. Tausworthe                *
  4.  *            Jet Propulsion Laboratory            *
  5.  *            Pasadena, CA 91009        1984        *
  6.  ************************************************************************/
  7.  
  8. #include "defs.h"
  9. #include "stdtyp.h"
  10.  
  11. /************************************************************************/
  12.     STRING
  13. rindex(s, c)    /* return pointer to last occurrence of char c in string
  14.            s, or NULL otherwise.                */
  15. /*----------------------------------------------------------------------*/
  16. STRING s;
  17. char c;
  18. {
  19.     STRING p;
  20.  
  21.     for (p = s; *s ; s++)
  22.         ;
  23.     while (c ISNT *s AND s >= p)
  24.         s--;
  25.     return (s < p ? NULL : s);
  26. }
  27.